//
//  Gzip.h
//  YuchBox
//
//  Created by Ivan on 11-10-11.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "zlib.h"
#import "Utility.h"

#define GZIP_HEADER_SIZE  sizeof(NSInteger)

@interface Gzip : NSObject

+ (void)zeroGzipReallocCounter;
+ (void)increaseGzipReallocCounter;
+ (NSInteger)getGzipReallocCounter;

+ (Boolean)gzipDeflate2WithDestData:(NSMutableData *)destData   // return the gzip status, 
                             offset:(NSInteger)offset           // which off
                         outDestLen:(uLong *)outDestLen         // to get the relly length after compress
                             source:(UInt8 *)source 
                          sourceLen:(NSInteger)sourceLen;

+ (void)gzipDeflate2WithDest:(UInt8 *)dest 
                     destLen:(NSInteger)destLen                 // dest buffer max aviliable space
                  outDestLen:(uLong *)outDestLen                // to get the really length after compress
                      source:(UInt8 *)source 
                   sourceLen:(NSInteger)sourceLen;

+ (void)gzipCompress:(UInt8 *)dest 
                     destLen:(NSInteger)destLen                 // dest buffer max aviliable space
                  outDestLen:(uLong *)outDestLen                // to get the really length after compress
                      source:(UInt8 *)source 
                   sourceLen:(NSInteger)sourceLen;

+ (Boolean)gzipinflate2WithDestData:(NSMutableData *)destData
                             offset:(NSInteger)offset 
                         outDestLen:(uLong *)outDestLen 
                             source:(UInt8 *)source
                          sourceLen:(NSInteger)sourceLen;

+ (void)gzipInflate2WithDest:(UInt8 *)dest 
                     destLen:(NSInteger)destLen 
                  outDestLen:(uLong *)outDestLen 
                      source:(UInt8 *)source 
                   sourceLen:(NSInteger)sourceLen;

@end
